ROS camera

您所在的位置:网站首页 如何使用LiNE Camera ROS camera

ROS camera

2024-07-06 07:53| 来源: 网络整理| 查看: 265

Kalibr是专门用于slam多传感器标定的功能包,可以实现单目相机标定、双目标定以及单、双目相机系统与IMU的联合标定,此教程只介绍单目标定。

安装配置Kalibr:

sudo apt-get install python-setuptools python-rosinstall ipython libeigen3-dev libboost-all-dev doxygen libopencv-dev ros-kinetic-vision-opencv ros-kinetic-image-transport-plugins ros-kinetic-cmake-modules python-software-properties software-properties-common libpoco-dev python-matplotlib python-scipy python-git python-pip ipython libtbb-dev libblas-dev liblapack-dev python-catkin-tools libv4l-dev sudo pip install python-igraph #cd to the src folder of a ros workspace git clone https://github.com/ethz-asl/kalibr.git cd .. catkin_make

Kalibr使用说明:

1、准备Aprilgrid标定版(Kalibr支持三种标定板:Aprilgrid、Checkerboard、Circlegrid)

2、启动相机节点

3、将相机话题设定为4hz,并录包

rosrun topic_tools throttle messages /camera_front/image_color 4.0 [rename to /left] rosbag record -O camera_calib.bag /camera_front/image_color_throttle[or /left]

4、创建Aprilgrid参数yaml:

gedit aprilgrid.yaml >>type in following information target_type: 'aprilgrid' #gridtype tagCols: 6 #number of apriltags tagRows: 6 #number of apriltags tagSize: 0.033 #size of apriltag, edge to edge [m] tagSpacing: 0.0099 #ratio of space between tags to tagSize

5、利用kalibr对pinhole-radtan模型进行单目标定:

rosrun kalibr kalibr_calibrate_cameras --bag /home/dst-01/robosense/camera_calib.bag --topics /camera_front/image_color_throttle --models pinhole-radtan --target /home/dst-01/robosense/src/kalibr/aslam_offline_calibration/kalibr/aprilgrid.yaml

注:Kalibr经常出现标定失败的情况,主要原因在于移动标定板太快,需要稳定在一定距离、缓慢移动。

/*****************************************************************************************************************/

ROS自带的标定工具使用也比较方便,一般desktop-full安装都会自带。

启动相机节点后调用标定工具:

rosrun camera_calibration cameracalibrator.py --no-service-check --size 15x15[棋盘格内角点数] --square 0.0011 image:=/camera_front/image_raw camera:=/camera_font

标定结果当中,Kalibr输出的内参格式为:fx,fy,cx,cy,畸变参数为:k1,k2,p1,p2(径向畸变参数k1、k2,切向畸变参数p1,p2)

而ROS标定工具直接输出了内参矩阵K=[fx, 0, cx; 0, fy, cy; 0, 0, 1],畸变参数为[k1, k2, p1, p2, k3]

OpenCV当中利用内参矩阵和畸变参数进行图像校正时,采用的是五位畸变参数,与ROS标定的畸变参数格式相同。但是径向畸变的参数k1、k2、k3当中,k3的影响较小,ROS标定工具的输出中k3均为0,所以在利用Kalibr标定后,直接在畸变参数中最后一位加0变成五位即可调用OpenCV校正。

/********************************单目标定到此为止,以下为双目标定操作************************************/

ROS的calibration包也可以用来标定双目,自己搭的双目固定好后,写好ros驱动发出对应的话题即可。双目标定之前并不需要先将两个单目分别标定,直接运行以下指令:

rosrun camera_calibration cameracalibrator.py --size 11x8 --square 0.06 right:=/camera_right/image_color left:=/camera_left/image_color right_camera:=/camera_right left_camera:=/camera_left --no-service-check --approximate=0.1

因为自己写的驱动包一般都没有调整参数的service所以要加上--no-service-check这个参数,和标单目一样,在窗口里移动标定板使得x、y、size、skew这些都变绿就可以点击calibrate标注了。

最终的输出结果包含了两个相机的内参以及坐标变换的T和R:

Left: ('D = ', [-0.11686719753732033, 0.06181331149820709, -0.00024274166155764925, 0.0001314349475535869, 0.0]) ('K = ', [1067.685025387197, 0.0, 973.8061212250898, 0.0, 1067.860035586445, 404.08282377401366, 0.0, 0.0, 1.0]) ('R = ', [0.9087632237154527, -0.36579417873904707, -0.20085821373029392, 0.35370160238488846, 0.9305784031899749, -0.09444052089415333, 0.2214601085808922, 0.014780200168566009, 0.9750574167659649]) ('P = ', [6816.87457639205, 0.0, 1306.516616821289, 0.0, 0.0, 6816.87457639205, 498.9466655552387, 0.0, 0.0, 0.0, 1.0, 0.0]) Right: ('D = ', [-0.11342694997275782, 0.0543007891147292, -3.014475923622502e-05, 0.0002960475019230181, 0.0]) ('K = ', [1060.6244985091334, 0.0, 969.5938634302636, 0.0, 1060.8564175594329, 404.2911667506857, 0.0, 0.0, 1.0]) ('R = ', [0.9190182416940134, -0.36038182341200825, -0.15978239198322258, 0.3689129274183662, 0.9290903472065573, 0.026351066604793458, 0.1389558326132998, -0.08316290087433859, 0.9868004907279432]) ('P = ', [6816.87457639205, 0.0, 1306.516616821289, -1254.4082609337024, 0.0, 6816.87457639205, 498.9466655552387, 0.0, 0.0, 0.0, 1.0, 0.0]) ('self.T ', [-0.16911328812211893, 0.06631571863504016, 0.029402382310161804]) ('self.R ', [0.9964282473220243, 0.00918467496707196, -0.08394277624970534, -0.017298268102591025, 0.9951878205286516, -0.09644673033381226, 0.08265299667531562, 0.09755431111530369, 0.9917921347356052]) None # oST version 5.0 parameters

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3